package com.cd.system.aspect;

import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;

//@Component
//@Aspect
public class TestAspect {

    private static final Logger logger = org.slf4j.LoggerFactory.getLogger(TestAspect.class);

    //@Pointcut("execution(* com.cd.server.service.impl.TestServiceImpl.testSync1())")
    @Pointcut("execution(* com.cd.system.service.impl.TestServiceImpl.*(..))")
    public void serviceLayerMethods(){}

    @Before("serviceLayerMethods()")
    public void logBefore() {
        logger.info("我是before切面");
    }

    @AfterReturning(pointcut = "serviceLayerMethods()",returning = "result")
    public void logAfterReturning(Object result) {
        logger.info("我是afterReturning切面，返回值是：{}",result);
    }
}
